def ImportWrite():
    import nuke,os
    wL = nuke.selectedNodes('Write')
    if not len(wL) == 0:
        for w in wL:
            [xpos,ypos] = [w.xpos(),w.ypos()]
            wFileName = w['file'].getValue()
            if w.Class() in ['Write']:
                if '%v' in wFileName:
                    path = wFileName.split('%v')[0]
                    views = nuke.root()['hero_view'].value()
                    filePath = os.path.join(path, views)
                else:
                    filePath = wFileName.split('/')[len(wFileName.split('/'))-1]
                    filePath = wFileName.replace(filePath, "")

# filePath is the final directory of your sequence
# it will dig out the files only if you find a real path

                if os.path.isdir(filePath):
                    fileNameList = nuke.getFileNameList(filePath)
                    if not len(fileNameList) == 0:
                        for file in fileNameList:
                            fileDir = os.path.join(filePath, file)
                            r = nuke.nodes.Read()
                            r['file'].fromUserText(fileDir)
                            r.setXYpos(xpos,ypos + 50)
                    else:
                        nuke.message('not a file')
                else:
                    nuke.message('not a path')
    else:
        nuke.message('No write nodes selected')
